package com.yyt.yytojbackendquestionservice.controller.inner;

import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yyt.yytojbackendcommon.annotation.AuthCheck;
import com.yyt.yytojbackendcommon.common.BaseResponse;
import com.yyt.yytojbackendcommon.common.DeleteRequest;
import com.yyt.yytojbackendcommon.common.ErrorCode;
import com.yyt.yytojbackendcommon.common.ResultUtils;
import com.yyt.yytojbackendcommon.constant.UserConstant;
import com.yyt.yytojbackendcommon.exception.BusinessException;
import com.yyt.yytojbackendcommon.exception.ThrowUtils;
import com.yyt.yytojbackendmodel.model.dto.question.*;
import com.yyt.yytojbackendmodel.model.dto.questionsubmit.QuestionSubmitQueryRequest;
import com.yyt.yytojbackendmodel.model.dto.questionsubmit.QuestionSumbitAddRequest;
import com.yyt.yytojbackendmodel.model.entity.Question;
import com.yyt.yytojbackendmodel.model.entity.QuestionSubmit;
import com.yyt.yytojbackendmodel.model.entity.User;
import com.yyt.yytojbackendmodel.model.vo.QuestionSubmitVO;
import com.yyt.yytojbackendmodel.model.vo.QuestionVO;
import com.yyt.yytojbackendquestionservice.service.QuestionService;
import com.yyt.yytojbackendquestionservice.service.QuestionSubmitService;
import com.yyt.yytojbackendserviceclient.service.JudgeFeignClient;
import com.yyt.yytojbackendserviceclient.service.QuestionFeignClient;
import com.yyt.yytojbackendserviceclient.service.UserFeignClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.concurrent.CompletableFuture;

/**
 * 题目内部接口
 *
 * @author yyt
*
 */
@RestController
@RequestMapping("/inner")
public class QuestionInnerController implements QuestionFeignClient {

    @Resource
    private QuestionService questionService;

    @Resource
    private QuestionSubmitService questionSubmitService;

    @Override
    @GetMapping("/get/id")
    public Question getQuestionById(long questionId) {
        return questionService.getById(questionId);
    }

    @Override
    @GetMapping("/question_submit/get/id")
    public QuestionSubmit getQuestionSubmitById(long questionSubmitId) {
        return questionSubmitService.getById(questionSubmitId);
    }

    @Override
    @PostMapping("/question_submit/update")
    public boolean updateQuestionSubmitById(QuestionSubmit questionSubmit) {
        return questionSubmitService.updateById(questionSubmit);
    }
}
